<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="css/mui.min.css" rel="stylesheet" />
		<style type="text/css">
			.self-head {
				height: 10%;
				background: #EC971F;
				text-align: center;
				padding-top: 3px;
			}
			
			.self-body {
				height: 80%;
			}
			
			.self-foot {
				background: #0062CC;
			}
			
			h1 {
				align-self: center;
			}
		</style>
	</head>

	<body>
		<script src="js/mui.min.js"></script>
		<script type="text/javascript">
			mui.init()
		</script>
		<div id="container">
			<div class="self-head">
				<h1>评论</h1>
			</div>
			<div class="self-body">
				<div class="mui-input-row" style="margin: 10px 5px;">
					<textarea id="content" rows="20" placeholder="多行文本框"></textarea>
				</div>
			</div>
			<div id="foot" class="self-foot">
				<div class="mui-button-row">
					<button class="mui-btn-grey mui-action-back" style="float: left;">返回</button>
					<button id="send" class="mui-btn-blue" style="float: right;">发表</button>
				</div>
			</div>
		</div>
		<script type="text/javascript">
			var h = document.documentElement.clientHeight;
			var container = document.getElementById("container")
			var foot = document.getElementById("foot")
			container.style.height = h + "px";
			console.log((h * 0.1 - 3) + "px");
			foot.style.height = (h * 0.1 - 10) + "px";
			//页面功能
			var send = document.getElementById("send");
			send.addEventListener("tap", function() {
				var name = localStorage.getItem("name");
				var mvid = plus.webview.currentWebview().mid;
				var content = document.getElementById("content");
				var timer = new Date();
				var year = timer.getFullYear();
				var month = timer.getMonth() + 1;
				var day = timer.getDate();
				var ymd = year + "-" + month + "-" + day;

				console.log(content.value + ymd);
				console.log("评论电影id：" + plus.webview.currentWebview().mid);
				mui.ajax("http://www.liwbiy.com:8080/Leisurelife/dealcmd", {
					type: "post",
					contentType: "application/x-www-form-urlencoded; charset=UTF-8",
					data: {
						cmd: 3,
						name: name,
						"yyyy-MM-dd": ymd,
						content: content.value,
						type: 1,
						tid: mvid
					},
					success: function(data) {
						var json = eval('(' + data + ')');
						if(json.code == null || json.code == '1') {
							mui.toast("发表评论失败");
						} else {
							mui.toast("发表评论成功");
						}
					},
					error: function() {
						mui.alert("网络连接出错");
					}
				});
			})
		</script>
	</body>

</html>